﻿Imports Commander_Wars.Spieletools
'Wettereffekte
'Sandsturm -20 und -1  Fertig
'Schnee 1/2 Sprit Bew-=1  'Fertif
'Regen Kriegsnebel + Sicht=1 'Fertig
#Region "Angriffstabelle"
Public Class AngriffstabelleMotorradMG
    Inherits Angriffstabelle
    Public Sub New()
        'Infantrie
        INF = 35
        MECH = 75
        SSIEINHEIT = 35
        MOTORRAD = 55
        'Panzer
        FLAK = 3
        JGPZ = 3
        SPAEHER = 10
        KPZ = 1
        TITANPZ = 1
        MEGAPZ = 1
        TTP = 15
        ART = 10
        RKW = 20
        MISSILE = 20
        BAUPANZER = 15
        PANZERABWEHRKANONE = 30
        'Luftwaffe
        BOMBER = -1
        KHELI = 3
        THELI = 15
        JAEGER = -1
        WASSERFLUGZEUG = -1
        AUFKLAERER = -1
        'Seewaffe
        UBOOT = -1
        ZERSTOERER = -1
        KREUZER = -1
        SCHLFF = -1
        FLTR = -1
        LBOOT = -1
        'Gebaeude
        Gebaeude = 1
    End Sub
End Class
Public Class AngriffstabelleScharfschuetzenMG
    Inherits Angriffstabelle
    Public Sub New()
        'Infantrie
        INF = 55
        MECH = 55
        SSIEINHEIT = 55
        MOTORRAD = 55
        'Panzer
        FLAK = 3
        JGPZ = 3
        SPAEHER = 10
        KPZ = 1
        TITANPZ = 1
        MEGAPZ = 1
        TTP = 10
        ART = 10
        RKW = 15
        MISSILE = 15
        BAUPANZER = 15
        PANZERABWEHRKANONE = 25
        'Luftwaffe
        BOMBER = -1
        KHELI = 3
        THELI = 15
        JAEGER = -1
        WASSERFLUGZEUG = -1
        AUFKLAERER = -1
        'Seewaffe
        UBOOT = -1
        ZERSTOERER = -1
        KREUZER = -1
        SCHLFF = -1
        FLTR = -1
        LBOOT = -1
        'Gebaeude
        Gebaeude = 1
    End Sub
End Class
Public Class AngriffstabelleZerstoererFlak
    Inherits Angriffstabelle
    Public Sub New()
        'Infantrie
        INF = -1
        MECH = -1
        SSIEINHEIT = -1
        MOTORRAD = -1
        'Panzer
        SPAEHER = -1
        FLAK = -1
        JGPZ = -1
        KPZ = -1
        MEGAPZ = -1
        TITANPZ = -1
        ART = -1
        PANZERABWEHRKANONE = -1
        RKW = -1
        MISSILE = -1
        TTP = -1
        BAUPANZER = -1
        'Luftwaffe
        JAEGER = 35
        BOMBER = 20
        AUFKLAERER = 35
        WASSERFLUGZEUG = 85
        KHELI = 45
        THELI = 55
        'Seewaffe
        KREUZER = -1
        UBOOT = -1
        ZERSTOERER = -1
        FLTR = -1
        SCHLFF = -1
        LBOOT = -1
        'Gebaeude
        Gebaeude = -1
    End Sub
End Class
Public Class AngriffstabelleTTPMG
    Inherits Angriffstabelle
    Public Sub New()
        'Infantrie
        INF = 60
        MECH = 60
        SSIEINHEIT = 60
        MOTORRAD = 60
        'Panzer
        FLAK = 3
        JGPZ = 3
        SPAEHER = 8
        KPZ = 1
        TITANPZ = 1
        MEGAPZ = 1
        TTP = 10
        ART = 15
        RKW = 20
        MISSILE = 20
        BAUPANZER = 15
        PANZERABWEHRKANONE = 5
        'Luftwaffe
        BOMBER = -1
        KHELI = 9
        THELI = 15
        JAEGER = -1
        WASSERFLUGZEUG = -1
        AUFKLAERER = -1
        'Seewaffe
        UBOOT = -1
        ZERSTOERER = -1
        KREUZER = -1
        SCHLFF = -1
        FLTR = -1
        LBOOT = -1
        'Gebaeude
        Gebaeude = 1
    End Sub
End Class
#End Region
#Region "Feuerkrafttabelle"
''' <summary>
''' Eine Feuerkrafttabelle fuer KO's mit einem bestimmten Wert fuer alle Truppen!!!
''' </summary>
''' <remarks></remarks>
Public Class FeuerkrafttabelleCustomAlles
    Inherits Angriffstabelle
    Dim Wert As Integer = 100
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Return Wert
    End Function
    Public Overrides Function ToString() As String
        Return "Alles|" + Wert.ToString
    End Function
End Class
Public Class FeuerkrafttabelleCustomSeeOffLuftOff
    Inherits Angriffstabelle
    Dim LuftOff As Integer
    Dim SeeOff As Integer
    Dim BodenOff As Integer
    Public Sub New(ByVal LuftOff As Integer, ByVal SeeOff As Integer, ByVal BodenOff As Integer)
        Me.LuftOff = LuftOff
        Me.SeeOff = SeeOff
        Me.BodenOff = BodenOff
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        Select Case E.Bewegungsart.ToUpper
            Case MovementSorts.Flugzeug.ToString.ToUpper
                Return LuftOff
            Case MovementSorts.Helikopter.ToString.ToUpper
                Return LuftOff
            Case MovementSorts.Transport.ToString.ToUpper
                Return SeeOff
            Case MovementSorts.Schiff.ToString.ToUpper
                Return SeeOff
            Case MovementSorts.Fuss.ToString.ToUpper
                Return 100
            Case MovementSorts.Mech.ToString.ToUpper
                Return 100
            Case MovementSorts.Hoellium.ToString.ToUpper
                Return 100
            Case MovementSorts.Amphibie.ToString.ToUpper
                Return SeeOff
            Case MovementSorts.Ketten.ToString.ToUpper
                Return BodenOff
            Case MovementSorts.Reifen.ToString.ToUpper
                Return BodenOff
            Case MovementSorts.Motorreifen.ToString.ToUpper
                Return 100
            Case Else
                Return BodenOff
        End Select
    End Function
    Public Overrides Function ToString() As String
        Return "SeeOffLuftOff|" + LuftOff.ToString + "|" + SeeOff + "|" + BodenOff
    End Function
End Class
Public Class FeuerkrafttabelleCustomFernkampf
    Inherits Angriffstabelle
    Dim Fernkampf As Integer
    Dim AndereWaffen As Integer
    Public Sub New(ByVal Fernkampf As Integer, ByVal AndereWaffen As Integer)
        Me.Fernkampf = Fernkampf
        Me.AndereWaffen = AndereWaffen
    End Sub

    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        If E.MaximaleReichweite > 1 Then
            Return Fernkampf
        Else
            Return AndereWaffen
        End If
    End Function

    Public Overrides Function ToString() As String
        Return "Fernkampf|" + Fernkampf.ToString + "|" + AndereWaffen.ToString
    End Function
End Class
Public Class FeuerkrafttabelleCustomFernkampfSee
    Inherits Angriffstabelle
    Dim Fernkampf As Integer
    Dim AndereWaffen As Integer
    Public Sub New(ByVal Fernkampf As Integer, ByVal AndereWaffen As Integer)
        Me.Fernkampf = Fernkampf
        Me.AndereWaffen = AndereWaffen
    End Sub

    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        If E.MaximaleReichweite > 1 Then
            Return Fernkampf
        ElseIf E.Bewegungsart.ToUpper = MovementSorts.Schiff.ToString.ToUpper Then
            Return Fernkampf
        ElseIf E.Bewegungsart.ToUpper = MovementSorts.Transport.ToString.ToUpper Then
            Return Fernkampf
        Else
            Return AndereWaffen
        End If
    End Function

    Public Overrides Function ToString() As String
        Return "Fernkampf|" + Fernkampf.ToString + "|" + AndereWaffen.ToString
    End Function
End Class
Public Class FeuerkrafttabelleCustomNahkampf
    Inherits Angriffstabelle
    Dim Panzer As Integer
    Dim Infis As Integer
    Dim Andere As Integer
    Public Sub New(ByVal Panzer As Integer, ByVal Infis As Integer, ByVal Andere As Integer)
        Me.Panzer = Panzer
        Me.Infis = Infis
        Me.Andere = Andere
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        If E.MinimaleReichweite = 1 And E.MaximaleReichweite = 1 Then
            If E.Bewegungsart.ToUpper = MovementSorts.Fuss.ToString.ToUpper Then
                Return Infis
            ElseIf E.Bewegungsart.ToUpper = MovementSorts.Mech.ToString.ToUpper Then
                Return Infis
            ElseIf E.Bewegungsart.ToUpper = MovementSorts.Motorreifen.ToString.ToUpper Then
                Return Infis
            Else
                Return Panzer
            End If
        Else
            Return Andere
        End If
    End Function
    Public Overrides Function ToString() As String
        Return "Nahkampf|" + Panzer.ToString + "|" + Infis.ToString + "|" + Andere.ToString
    End Function
End Class
Public Class FeuerkrafttabelleCustomHelis
    Inherits Angriffstabelle
    Dim Helis As Integer
    Dim Infis As Integer
    Dim Andere As Integer
    Dim Luftwaffe As Integer
    Public Sub New(ByVal Helis As Integer, ByVal Luftwaffe As Integer, ByVal Infis As Integer, ByVal Andere As Integer)
        Me.Helis = Helis
        Me.Infis = Infis
        Me.Andere = Andere
        Me.Luftwaffe = Luftwaffe
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        Select Case E.Bewegungsart.ToUpper
            Case MovementSorts.Flugzeug.ToString.ToUpper
                Return Luftwaffe
            Case MovementSorts.Helikopter.ToString.ToUpper
                Return Helis
            Case MovementSorts.Transport.ToString.ToUpper
                Return Andere
            Case MovementSorts.Schiff.ToString.ToUpper
                Return Andere
            Case MovementSorts.Fuss.ToString.ToUpper
                Return Infis
            Case MovementSorts.Mech.ToString.ToUpper
                Return Infis
            Case MovementSorts.Hoellium.ToString.ToUpper
                Return Andere
            Case MovementSorts.Amphibie.ToString.ToUpper
                Return Andere
            Case MovementSorts.Ketten.ToString.ToUpper
                Return Andere
            Case MovementSorts.Reifen.ToString.ToUpper
                Return Andere
            Case MovementSorts.Motorreifen.ToString.ToUpper
                Return Infis
            Case Else
                Return Andere
        End Select
    End Function
    Public Overrides Function ToString() As String
        Return "Helis|" + Helis.ToString + "|" + Luftwaffe.ToString + "|" + Infis.ToString + "|" + Andere.ToString
    End Function
End Class
Public Class FeuerkrafttabelleCustomINF
    Inherits Angriffstabelle
    Dim SeeLuft As Integer
    Dim INFI As Integer
    Dim Andere As Integer
    Public Sub New(ByVal SeeLuft As Integer, ByVal INFI As Integer, ByVal Andere As Integer)
        Me.SeeLuft = SeeLuft
        Me.INFI = INFI
        Me.Andere = Andere
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        Select Case E.Bewegungsart.ToUpper
            Case MovementSorts.Flugzeug.ToString.ToUpper
                Return SeeLuft
            Case MovementSorts.Helikopter.ToString.ToUpper
                Return SeeLuft
            Case MovementSorts.Transport.ToString.ToUpper
                Return SeeLuft
            Case MovementSorts.Schiff.ToString.ToUpper
                Return SeeLuft
            Case MovementSorts.Fuss.ToString.ToUpper
                Return INFI
            Case MovementSorts.Mech.ToString.ToUpper
                Return INFI
            Case MovementSorts.Hoellium.ToString.ToUpper
                Return 95
            Case MovementSorts.Amphibie.ToString.ToUpper
                Return Andere
            Case MovementSorts.Ketten.ToString.ToUpper
                Return Andere
            Case MovementSorts.Reifen.ToString.ToUpper
                Return Andere
            Case MovementSorts.Motorreifen.ToString.ToUpper
                Return INFI
            Case Else
                Return Andere
        End Select
    End Function
    Public Overrides Function ToString() As String
        Return "Infantrie|" + SeeLuft.ToString + "|" + INFI.ToString + "|" + Andere.ToString
    End Function
End Class
#End Region
#Region "BewegungsBonusTabellen"
Public Class BewegungsboniTabelleCustomAlles
    Inherits BewegungsboniTabelle
    Dim Wert As Integer
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Return Wert
    End Function
    Public Overrides Function ToString() As String
        Return "Alles|" + Wert.ToString
    End Function
End Class
Public Class BewegungsboniTabelleCustomFern_Panzer
    Inherits BewegungsboniTabelle
    Dim Wert As Integer
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        Select Case E.Bewegungsart.ToUpper
            Case MovementSorts.Flugzeug.ToString.ToUpper
                Return 0
            Case MovementSorts.Helikopter.ToString.ToUpper
                Return 0
            Case MovementSorts.Transport.ToString.ToUpper
                Return 0
            Case MovementSorts.Schiff.ToString.ToUpper
                Return 0
            Case MovementSorts.Fuss.ToString.ToUpper
                Return 0
            Case MovementSorts.Mech.ToString.ToUpper
                Return 0
            Case MovementSorts.Hoellium.ToString.ToUpper
                Return 0
            Case MovementSorts.Amphibie.ToString.ToUpper
                Return 0
            Case MovementSorts.Ketten.ToString.ToUpper
                Return Wert
            Case MovementSorts.Reifen.ToString.ToUpper
                Return Wert
            Case MovementSorts.Motorreifen.ToString.ToUpper
                Return 0
            Case Else
                Return 0
        End Select
    End Function
    Public Overrides Function ToString() As String
        Return "FernPanzer|" + Wert.ToString
    End Function
End Class
Public Class BewegungsboniTabelleCustomHovercraft
    Inherits BewegungsboniTabelle
    Dim Wert As Integer
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        Select Case E.Bewegungsart.ToUpper
            Case MovementSorts.Flugzeug.ToString.ToUpper
                Return 0
            Case MovementSorts.Helikopter.ToString.ToUpper
                Return 0
            Case MovementSorts.Transport.ToString.ToUpper
                Return 0
            Case MovementSorts.Schiff.ToString.ToUpper
                Return 0
            Case MovementSorts.Fuss.ToString.ToUpper
                Return 0
            Case MovementSorts.Mech.ToString.ToUpper
                Return 0
            Case MovementSorts.Hoellium.ToString.ToUpper
                Return 0
            Case MovementSorts.Amphibie.ToString.ToUpper
                Return Wert
            Case MovementSorts.Ketten.ToString.ToUpper
                Return 0
            Case MovementSorts.Reifen.ToString.ToUpper
                Return 0
            Case MovementSorts.Motorreifen.ToString.ToUpper
                Return 0
            Case Else
                Return 0
        End Select
    End Function
    Public Overrides Function ToString() As String
        Return "Hovercraft|" + Wert.ToString
    End Function
End Class
Public Class BewegungsboniTabelleCustomINF
    Inherits BewegungsboniTabelle
    Dim Wert As Integer
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        Select Case E.Bewegungsart.ToUpper
            Case MovementSorts.Flugzeug.ToString.ToUpper
                Return 0
            Case MovementSorts.Helikopter.ToString.ToUpper
                Return 0
            Case MovementSorts.Transport.ToString.ToUpper
                Return 0
            Case MovementSorts.Schiff.ToString.ToUpper
                Return 0
            Case MovementSorts.Fuss.ToString.ToUpper
                Return Wert
            Case MovementSorts.Mech.ToString.ToUpper
                Return Wert
            Case MovementSorts.Hoellium.ToString.ToUpper
                Return 0
            Case MovementSorts.Amphibie.ToString.ToUpper
                Return 0
            Case MovementSorts.Ketten.ToString.ToUpper
                Return 0
            Case MovementSorts.Reifen.ToString.ToUpper
                Return 0
            Case MovementSorts.Motorreifen.ToString.ToUpper
                Return Wert
            Case Else
                Return 0
        End Select
    End Function
    Public Overrides Function ToString() As String
        Return "INF|" + Wert.ToString
    End Function
End Class
Public Class BewegungsboniTabelleCustomSee
    Inherits BewegungsboniTabelle
    Dim Wert As Integer
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        Select Case E.Bewegungsart.ToUpper
            Case MovementSorts.Flugzeug.ToString.ToUpper
                Return 0
            Case MovementSorts.Helikopter.ToString.ToUpper
                Return 0
            Case MovementSorts.Transport.ToString.ToUpper
                Return Wert
            Case MovementSorts.Schiff.ToString.ToUpper
                Return Wert
            Case MovementSorts.Fuss.ToString.ToUpper
                Return 0
            Case MovementSorts.Mech.ToString.ToUpper
                Return 0
            Case MovementSorts.Hoellium.ToString.ToUpper
                Return 0
            Case MovementSorts.Amphibie.ToString.ToUpper
                Return Wert
            Case MovementSorts.Ketten.ToString.ToUpper
                Return 0
            Case MovementSorts.Reifen.ToString.ToUpper
                Return 0
            Case MovementSorts.Motorreifen.ToString.ToUpper
                Return 0
            Case Else
                Return 0
        End Select
    End Function
    Public Overrides Function ToString() As String
        Return "See|" + Wert.ToString
    End Function
End Class
Public Class BewegungsboniTabelleCustomTransporter
    Inherits BewegungsboniTabelle
    Dim Wert As Integer
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        If E.Ladung.Length > 0 Then
            Return Wert
        End If
    End Function
    Public Overrides Function ToString() As String
        Return "Transport|" + Wert.ToString
    End Function
End Class
Public Class BewegungsboniTabelleCustomPanzer
    Inherits BewegungsboniTabelle
    Dim Wert As Integer
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        If E.MinimaleReichweite = 1 And E.MaximaleReichweite = 1 Then
            If E.Bewegungsart.ToUpper = MovementSorts.Ketten.ToString.ToUpper Then
                Return Wert
            ElseIf E.Bewegungsart.ToUpper = MovementSorts.Reifen.ToString.ToUpper Then
                Return Wert
            ElseIf E.Bewegungsart.ToUpper = MovementSorts.Schneeketten.ToString.ToUpper Then
                Return Wert
            ElseIf E.Bewegungsart.ToUpper = MovementSorts.Wuestenketten.ToString.ToUpper Then
                Return Wert
            Else
                Return 0
            End If
        Else
            Return 0
        End If
    End Function
    Public Overrides Function ToString() As String
        Return "Panzer|" + Wert.ToString
    End Function
End Class
Public Class BewegungsboniTabelleCustomNahkampf
    Inherits BewegungsboniTabelle
    Dim Wert As Integer
    Public Sub New(ByVal Wert As Integer)
        Me.Wert = Wert
    End Sub
    Public Overrides Function GetWert(ByVal Name As String) As Integer
        Dim E As ObjektEinheit = GetUnit(Name)
        If E.MinimaleReichweite = 1 And E.MaximaleReichweite = 1 Then
            If E.Bewegungsart.ToUpper = MovementSorts.Fuss.ToString.ToUpper Then
                Return 0
            ElseIf E.Bewegungsart.ToUpper = MovementSorts.Mech.ToString.ToUpper Then
                Return 0
            ElseIf E.Bewegungsart.ToUpper = MovementSorts.Motorreifen.ToString.ToUpper Then
                Return 0
            Else
                Return Wert
            End If
        Else
            Return 0
        End If
    End Function
    Public Overrides Function ToString() As String
        Return "Nahkampf|" + Wert.ToString
    End Function
End Class
#End Region
#Region "Baublockade"
Public Class Baublockade
    Const Money As Integer = 99999
    Const AbweichungsProzent As Single = 0.08
    Enum BauBlockade
        Normal
        Air
        Sea
        Indirect
        Direct
        Ground
        Infantry
        InfantryAir
        AirSea
        IndirectSea
    End Enum
    Dim SeaForce As Integer
    Dim SeaProzent As Single
    Dim SeaUnits As Integer = 0
    Dim AirForce As Integer
    Dim AirProzent As Single
    Dim AirUnits As Integer = 0
    Dim GroundDirectForce As Integer
    Dim GroundDirectProzent As Single
    Dim GroundDirectUnits As Integer = 0
    Dim GroundIndirectForce As Integer
    Dim GroundIndirectProzent As Single
    Dim GroundIndirectUnits As Integer = 0
    Dim InfantryForce As Integer
    Dim InfantryProzent As Single
    Dim InfantryUnits As Integer = 0
    Dim Spieler As Integer

    Dim CanProduceAir As Boolean = False
    Dim CanProduceSea As Boolean = False
    Dim CanProduceInfantry As Boolean = False
    Dim CanProduceGroundDirect As Boolean = False
    Dim CanProduceGroundIndirect As Boolean = False
    Dim OwnUnits As Integer = 0
    Public Sub New(ByVal BlockadeTyp As BauBlockade, ByVal Spieler As Integer)
        Me.Spieler = Spieler
        Select Case BlockadeTyp
            Case BauBlockade.Normal
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 11
                GroundDirectProzent = 0.225
                GroundIndirectForce = 11
                GroundIndirectProzent = 0.225
                AirForce = 11
                AirProzent = 0.225
                SeaForce = 11
                SeaProzent = 0.225
            Case BauBlockade.Air
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 11
                GroundDirectProzent = 0.225
                GroundIndirectForce = 11
                GroundIndirectProzent = 0.225
                AirForce = 17
                AirProzent = 0.3375
                SeaForce = 5
                SeaProzent = 0.1125
            Case BauBlockade.AirSea
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 6
                GroundDirectProzent = 0.1125
                GroundIndirectForce = 6
                GroundIndirectProzent = 0.1125
                AirForce = 16
                AirProzent = 0.3375
                SeaForce = 16
                SeaProzent = 0.3375
            Case BauBlockade.Sea
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 11
                GroundDirectProzent = 0.225
                GroundIndirectForce = 11
                GroundIndirectProzent = 0.225
                AirForce = 5
                AirProzent = 0.1125
                SeaForce = 17
                SeaProzent = 0.3375
            Case BauBlockade.Direct
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 17
                GroundDirectProzent = 0.3375
                GroundIndirectForce = 5
                GroundIndirectProzent = 0.1125
                AirForce = 11
                AirProzent = 0.225
                SeaForce = 11
                SeaProzent = 0.225
            Case BauBlockade.Indirect
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 5
                GroundDirectProzent = 0.1125
                GroundIndirectForce = 17
                GroundIndirectProzent = 0.3375
                AirForce = 11
                AirProzent = 0.225
                SeaForce = 11
                SeaProzent = 0.225
            Case BauBlockade.Infantry
                InfantryForce = 14
                InfantryProzent = 0.2
                GroundDirectForce = 8
                GroundDirectProzent = 0.175
                GroundIndirectForce = 8
                GroundIndirectProzent = 0.175
                AirForce = 11
                AirProzent = 0.225
                SeaForce = 11
                SeaProzent = 0.225
            Case BauBlockade.InfantryAir
                InfantryForce = 14
                InfantryProzent = 0.2
                GroundDirectForce = 8
                GroundDirectProzent = 0.175
                GroundIndirectForce = 8
                GroundIndirectProzent = 0.175
                AirForce = 17
                AirProzent = 0.3375
                SeaForce = 5
                SeaProzent = 0.1125
            Case BauBlockade.Ground
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 17
                GroundDirectProzent = 0.3375
                GroundIndirectForce = 17
                GroundIndirectProzent = 0.3375
                AirForce = 5
                AirProzent = 0.1125
                SeaForce = 5
                SeaProzent = 0.1125
            Case BauBlockade.IndirectSea
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 5
                GroundDirectProzent = 0.1125
                GroundIndirectForce = 17
                GroundIndirectProzent = 0.3375
                AirForce = 5
                AirProzent = 0.1125
                SeaForce = 17
                SeaProzent = 0.3375
            Case Else
                InfantryForce = 7
                InfantryProzent = 0.1
                GroundDirectForce = 11
                GroundDirectProzent = 0.225
                GroundIndirectForce = 11
                GroundIndirectProzent = 0.225
                AirForce = 11
                AirProzent = 0.225
                SeaForce = 11
                SeaProzent = 0.225
        End Select
        UpdateValues()
    End Sub
    Public Sub UpdateValues()
        CanProduceAir = False
        CanProduceSea = False
        CanProduceInfantry = False
        CanProduceGroundDirect = False
        CanProduceGroundIndirect = False
        InfantryUnits = 0
        GroundDirectUnits = 0
        GroundIndirectUnits = 0
        SeaUnits = 0
        AirUnits = 0
        OwnUnits = 0
        For I = 0 To ObjektSpielfeld.Luftschlacht
            For X = 0 To Objektverwalter.Spielfeld.Breite - 1
                For Y = 0 To Objektverwalter.Spielfeld.Hoehe - 1
                    Dim G As ObjektGebaeude = Objektverwalter.Spielfeld.Landschaften(X, Y, I).Gebaeude
                    If G IsNot Nothing Then
                        If G.Spieler = Spieler Then
                            If Not CanProduceAir Then
                                If G.GetAirUnits(Money).Length > 0 Then
                                    CanProduceAir = True
                                End If
                            End If
                            If Not CanProduceSea Then
                                If G.GetSeaUnits(Money).Length > 0 Then
                                    CanProduceSea = True
                                End If
                            End If
                            If Not (CanProduceInfantry And CanProduceGroundDirect And CanProduceGroundIndirect) Then
                                Dim GB As ObjektEinheit() = G.GetGroundUnits(Money)
                                If GB.Length > 0 Then
                                    For I2 = 0 To GB.Length - 1
                                        If GB(I2).KannBesetzen And Not CanProduceInfantry Then
                                            CanProduceInfantry = True
                                        ElseIf GB(I2).IsDirectUnit And Not CanProduceGroundDirect Then
                                            CanProduceGroundDirect = True
                                        ElseIf GB(I2).IsIndirectUnit And Not CanProduceGroundIndirect Then
                                            CanProduceGroundIndirect = True
                                        End If
                                    Next
                                End If
                            End If
                        End If
                    End If
                    Dim E As ObjektEinheit = Objektverwalter.Spielfeld.Einheiten(X, Y, I)
                    If E IsNot Nothing Then
                        If E.Spieler = Spieler Then
                            If Not E.HasNoWeapons Then
                                If E.IsSeaUnit Then
                                    SeaUnits += 1
                                    OwnUnits += 1
                                ElseIf E.IsFlyingUnit Then
                                    AirUnits += 1
                                    OwnUnits += 1
                                Else
                                    If E.KannBesetzen Then
                                        InfantryUnits += 1
                                        OwnUnits += 1
                                    ElseIf E.IsDirectUnit Then
                                        GroundDirectUnits += 1
                                        OwnUnits += 1
                                    ElseIf E.IsIndirectUnit Then
                                        GroundIndirectUnits += 1
                                        OwnUnits += 1
                                    End If
                                End If
                            End If
                        End If
                    End If
                Next
            Next
        Next
        If Not CanProduceAir Then
            OwnUnits += Math.Round((CSng(OwnUnits) * AirProzent / (1.0 - AirProzent)), System.MidpointRounding.AwayFromZero)
        End If
        If Not CanProduceSea Then
            OwnUnits += Math.Round((CSng(OwnUnits) * SeaProzent / (1.0 - SeaProzent)), System.MidpointRounding.AwayFromZero)
        End If
        If Not CanProduceGroundDirect Then
            OwnUnits += Math.Round((CSng(OwnUnits) * GroundDirectProzent / (1.0 - GroundDirectProzent)), System.MidpointRounding.AwayFromZero)
        End If
        If Not CanProduceGroundIndirect Then
            OwnUnits += Math.Round((CSng(OwnUnits) * GroundIndirectProzent / (1.0 - GroundIndirectProzent)), System.MidpointRounding.AwayFromZero)
        End If
        If Not CanProduceInfantry Then
            OwnUnits += Math.Round((CSng(OwnUnits) * InfantryProzent / (1.0 - InfantryProzent)), System.MidpointRounding.AwayFromZero)
        End If
    End Sub
    Private Function GetSpieler() As ObjektSpieler
        Return Objektverwalter.Spielfeld.Spieler(Spieler)
    End Function
    Public Function CanBuildUnit(ByVal Einheit As String) As Boolean
        Return CanBuildUnit(ObjektLadeklasse.NewEinheit(Einheit, Spieler, -1, -1, ))
    End Function
    Public Function CanBuildUnit(ByVal Einheit As ObjektEinheit) As Boolean
        If Einheit.HasNoWeapons Then Return True
        If Einheit.IsFlyingUnit Then
            If AirUnits < AirForce Then
                Return True
            ElseIf AirUnits < (AirProzent + AbweichungsProzent) * OwnUnits Then
                Return True
            End If
        ElseIf Einheit.IsSeaUnit Then
            If SeaUnits < SeaForce Then
                Return True
            ElseIf SeaUnits < (SeaProzent + AbweichungsProzent) * OwnUnits Then
                Return True
            End If
        Else
            If Einheit.KannBesetzen Then
                If InfantryUnits < InfantryForce Then
                    Return True
                ElseIf InfantryUnits < (InfantryProzent + AbweichungsProzent) * OwnUnits Then
                    Return True
                End If
            ElseIf Einheit.IsDirectUnit Then
                If GroundDirectUnits < GroundDirectForce Then
                    Return True
                ElseIf GroundDirectUnits < (GroundDirectProzent + AbweichungsProzent) * OwnUnits Then
                    Return True
                End If
            ElseIf Einheit.IsIndirectUnit Then
                If GroundIndirectUnits < GroundIndirectForce Then
                    Return True
                ElseIf GroundIndirectUnits < (GroundIndirectProzent + AbweichungsProzent) * OwnUnits Then
                    Return True
                End If
            End If
        End If
        Return False
    End Function
End Class
#End Region
#Region "Bewegungstabelle"

Public Class BewegungstabelleWuestenketten_Sonne
    Inherits Bewegungstabelle
    Public Sub New()
        STADT = 1
        BASIS = 1
        HQ = 1
        WERFT = 1
        LABOR = 1
        FLUGHAFEN = 1
        TURM = 1
        STRASSE = 1
        EBENE = 1
        WALD = 2
        RAKETENSILORAKETE = 1
        RAKETENSILO = 1
        STRAND = 1
        EBENESCHROTT = 1
        BRUECKE = 1
        KAPUTTESCHWEISSNAHT = 1
        PIPESTATION = 1
        AUSGETROCKNETESFLUSSBETT = -1
        FELSEN = -1
        GIPFEL = -1
        KAKTEEN = 1
        KAPUTTEPIPESCHWEISS = 1
        KIEFERN = 3
        PFAD = 1
        PIPE = -1
        PIPELINE = -1
        PIPESCHWEISS = -1
        PLINE = -1
        PLINEKAPUTT = 2
        PLINESCHWEISS = -1
        SCHNEE = 2
        SCHWEISSNAHT = -1
        STRASSENFROST = 1
        WUESTE = 1
        ZUGBRUECKE = 1
        MINE = -1
        WUESTENSCHROTT = 1
        SCHNEESCHROTT = 2
        SUMPF = 3
        BAUBRUECKE = 1
        RADAR = 1
        TEMPWERFT = 1
        TEMPFLUGHAFEN = 1
        NEBEL = -1
        RAUESEE = -1
        OeDLAND = 2
        RUINEN = 1
    End Sub
End Class

Public Class BewegungstabelleSchneeketten_Sonne
    Inherits Bewegungstabelle
    Public Sub New()
        STADT = 1
        BASIS = 1
        HQ = 1
        WERFT = 1
        LABOR = 1
        FLUGHAFEN = 1
        TURM = 1
        STRASSE = 1
        EBENE = 1
        WALD = 2
        RAKETENSILORAKETE = 1
        RAKETENSILO = 1
        STRAND = 1
        EBENESCHROTT = 1
        BRUECKE = 1
        KAPUTTESCHWEISSNAHT = 1
        PIPESTATION = 1
        AUSGETROCKNETESFLUSSBETT = -1
        FELSEN = -1
        GIPFEL = -1
        KAKTEEN = 3
        KAPUTTEPIPESCHWEISS = 2
        KAPUTTESCHWEISSNAHT = 1
        KIEFERN = 1
        PFAD = 1
        PIPE = -1
        PIPELINE = -1
        PIPESCHWEISS = -1
        PLINE = -1
        PLINEKAPUTT = 1
        PLINESCHWEISS = -1
        SCHNEE = 1
        SCHWEISSNAHT = -1
        STRASSENFROST = 1
        WUESTE = 2
        ZUGBRUECKE = 1
        MINE = -1
        WUESTENSCHROTT = 2
        SCHNEESCHROTT = 1
        SUMPF = 3
        BAUBRUECKE = 1
        RADAR = 1
        TEMPWERFT = 1
        TEMPFLUGHAFEN = 1
        NEBEL = -1
        RAUESEE = -1
        OeDLAND = 2
        RUINEN = 1
    End Sub
End Class

#End Region